package com.qianfeng.ttgy;

import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RadioGroup;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.qianfeng.ttgy.fragment.GuoshiFragment;
import com.qianfeng.ttgy.fragment.MainFragment;
import com.qianfeng.ttgy.fragment.MeFragment;
import com.qianfeng.ttgy.fragment.PinleiFragment;
import com.qianfeng.ttgy.fragment.ShopCarFragment;
import com.qianfeng.ttgy.utils.FragmentTabUtils;

import java.util.ArrayList;
import java.util.List;

@ContentView(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {
    @ViewInject(R.id.main_rgs)
    private RadioGroup rgs;
    private List<Fragment> fs = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ViewUtils.inject(this);
        initView();
    }

    private void initView() {
        fs.add(new MainFragment());
        fs.add(new PinleiFragment());
        fs.add(new MeFragment());
        fs.add(new ShopCarFragment());
        fs.add(new GuoshiFragment());
        FragmentTabUtils utils = new FragmentTabUtils(getSupportFragmentManager(),fs,R.id.fragment_main_container,rgs);
        utils.setOnRgsExtraCheckedChangedListener(new FragmentTabUtils.OnRgsExtraCheckedChangedListener() {
            @Override
            public void OnRgsExtraCheckedChanged(RadioGroup radioGroup, int checkedId, int index) {

            }
        });

    }


}
